# $Id: Makefile,v 1.1.572.2 Broadcom SDK $
# $Copyright: Copyright 2011 Broadcom Corporation.
# This program is the proprietary software of Broadcom Corporation
# and/or its licensors, and may only be used, duplicated, modified
# or distributed pursuant to the terms and conditions of a separate,
# written license agreement executed between you and Broadcom
# (an "Authorized License").  Except as set forth in an Authorized
# License, Broadcom grants no license (express or implied), right
# to use, or waiver of any kind with respect to the Software, and
# Broadcom expressly reserves all rights in and to the Software
# and all intellectual property rights therein.  IF YOU HAVE
# NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS SOFTWARE
# IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE
# ALL USE OF THE SOFTWARE.  
#  
# Except as expressly set forth in the Authorized License,
#  
# 1.     This program, including its structure, sequence and organization,
# constitutes the valuable trade secrets of Broadcom, and you shall use
# all reasonable efforts to protect the confidentiality thereof,
# and to use this information only in connection with your use of
# Broadcom integrated circuit products.
#  
# 2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS
# PROVIDED "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
# REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
# OR OTHERWISE, WITH RESPECT TO THE SOFTWARE.  BROADCOM SPECIFICALLY
# DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
# NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
# ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
# CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
# OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
# 
# 3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL
# BROADCOM OR ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL,
# INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER
# ARISING OUT OF OR IN ANY WAY RELATING TO YOUR USE OF OR INABILITY
# TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF
# THE AMOUNT ACTUALLY PAID FOR THE SOFTWARE ITSELF OR USD 1.00,
# WHICHEVER IS GREATER. THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING
# ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.$

# Makefile - Standalone makefile for BCM570x driver
#
# modification history
# --------------------
# 01a,11jun02,jmb   Written
#
#
# DESCRIPTION
#
#    This is a standalone makefile for building the BCM570x network driver.
#    (It is here for illustrative purposes only.  For Strataswitch builds, the
#    driver is built in the BSP directory.)
#
#    Here's how to build for a PPC8245
#
#        make -f Makefile CPU=PPC603 TOOL=gnu
#
#    The results of the build will be a partially linked object module
#    called $(CPU)$(TOOL)/bcm570xdrv.o
#
#    Here's an example MIPS build
#
#        make -f Makefile CPU=RX32364 TOOL=sfgnu
#
#    N.B:  The standalone MIPS build for the RC32364 is currently broken because the
#          driver requires a header file in the idtrp334 BSP.  This needs to be
#          fixed at some point -- drivers shouldn't require any BSP headers.
#

BCM570X_OBJ_DIR = $(CPU)$(TOOL)

exe : $(BCM570X_OBJ_DIR) $(BCM570X_OBJ_DIR)/bcm570xdrv.o

TGT_DIR = $(WIND_BASE)/target

include $(TGT_DIR)/h/make/defs.bsp
include $(TGT_DIR)/h/make/make.$(CPU)$(TOOL)

ifeq ($(HOSTTYPE),Windows_Cygnus)
include $(TGT_DIR)/h/make/defs.unix
else
include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE)
endif

## Only redefine make definitions below this point, or your definitions will
## be overwritten by the makefile stubs above.

ADDED_CFLAGS   += -DBROADCOM_BSP

# Broadcom BCM570x Gigabit Ethernet Driver

BCM570X_OBJS = $(BCM570X_OBJ_DIR)/bcm570xEnd.o $(BCM570X_OBJ_DIR)/tigon3.o \
               $(BCM570X_OBJ_DIR)/autoneg.o $(BCM570X_OBJ_DIR)/5701rls.o

BCM570X_FLAGS = -DINCLUDE_5701_AX_FIX=1 -DVXWORKS -DDBG=0 

ifeq ($(CPU),RC32364)
BCM570X_FLAGS += -DBIG_ENDIAN_PCI=1
endif

$(BCM570X_OBJ_DIR):
	-mkdir $(BCM570X_OBJ_DIR)

$(BCM570X_OBJ_DIR)/bcm570xdrv.o : $(BCM570X_OBJS)
	$(LD_PARTIAL) -o $@ $(BCM570X_OBJS)

$(BCM570X_OBJ_DIR)/%.o : %.c
	$(CC) -I. $(CFLAGS) $(BCM570X_FLAGS) -O0 -c $< -o $@

clean :
	$(RM) $(BCM570X_OBJ_DIR)/*.o


## Only redefine make definitions above this point, or the expansion of 
## makefile target dependencies may be incorrect.

ifeq ($(OS),Windows_Cygnus)
include $(TGT_DIR)/h/make/rules.unix
else
include $(TGT_DIR)/h/make/rules.$(WIND_HOST_TYPE)
endif
